<template>
	<view class="container">
		<TopBtn :title="'消息通知'"></TopBtn>
		<view class="prompt flex-sp-center">
			<view class="flex-center">
				<text>X</text> 开启推送通知，重要消息不错过
			</view>
			<view class="btn flex-center-center">
				去开启
			</view>
		</view>
		<view class="info">
			<view class="row flex-sp-center" v-if="noticeList.title" @click="goInfo()">
				<image src="@/static/my/xtcz.png" mode=""></image>
				<view class="">
					<view class="title flex-sp-center">
						{{noticeList.title}} <uni-dateformat :date="noticeList.createTime" format="hh:mm"></uni-dateformat>
					</view>
					<view class="text flex-sp-center">
						<view class="textInfo">
							{{noticeList.content}}
						</view>
						<view class="dian" v-if="noticeList.readStatus==0">

						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		notifyMessagePage
	} from '@/api/user'
	export default {
		data() {
			return {
				noticeList: {},
				request: {
					pageNo: 1,
					pageSize: 1,
				},
			};
		},
		onShow() {
			this.notifyMessagePage()
		},
		methods: {
			goInfo(e) {
				uni.navigateTo({
					url: `/pages/my/newsList/newsList?id=${e}`,
				})
			},
			notifyMessagePage() {
				notifyMessagePage(this.request).then(res => {
					if(res.data.list[0]&&res.data.list[0].title){
						this.noticeList = res.data.list[0]
					}
				})
			},
		}
	}
</script>

<style lang="less" scoped>
	.container {

		.prompt {
			width: 750rpx;
			height: 90rpx;
			background: rgba(235, 240, 254, 0.59);
			padding: 0 30rpx 0 50rpx;
			box-sizing: border-box;
			font-weight: 500;
			font-size: 24rpx;
			color: #3E6EFE;

			text {
				margin-right: 13rpx;
			}

			.btn {
				width: 136rpx;
				height: 65rpx;
				background: #3E6EFE;
				border-radius: 33rpx;
				font-weight: 500;
				font-size: 24rpx;
				color: #FFFFFF;
			}
		}

		.info {
			padding: 30rpx;

			.row {
				height: 180rpx;
				border-bottom: 1px solid #EEEEEE;

				image {
					width: 94rpx;
					height: 94rpx;
					margin-right: 18rpx;
				}

				&>view {
					flex: 1;

					.title {
						font-weight: 500;
						font-size: 30rpx;
						color: #333333;

						text {
							font-weight: 500;
							font-size: 28rpx;
							color: #999999;
						}
					}

					.text {
						font-weight: 500;
						font-size: 28rpx;
						color: #999999;
						margin-top: 15rpx;

						.dian {
							width: 18rpx;
							height: 18rpx;
							background: #FF4D3D;
							border-radius: 9rpx;
						}

						.textInfo {
							width: 450rpx;
							overflow: hidden;
							white-space: nowrap;
							text-overflow: ellipsis;
						}
					}
				}
			}


		}
	}
</style>